package yto.freemarker.springaop.aspectj;

import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.aspectj.lang.annotation.Pointcut;
import org.springframework.stereotype.Component;

/**
 * @author dongxing
 **/
@Component
@Aspect
public class YtoAspectj{

    @Pointcut("execution(* yto.freemarker.springaop.service..*.*(..))")
    public void point() {

    }

    @Before("point()")
    public void befor() {
        System.out.println("aop before");
    }

//    @Before("@annotation(yto.freemarker.springaop.aop.Hh)")
//    public void afe(ProceedingJoinPoint joinPoint) {
//        MethodSignature signature= (MethodSignature) joinPoint.getSignature();
//        Method method = signature.getMethod();
//        Hh annotation = method.getAnnotation(Hh.class);
//        System.out.println("注解 before");
//    }

//        @Before("@annotation(hh)")
//    public void afe(ProceedingJoinPoint joinPoint,Hh hh) {
//        MethodSignature signature= (MethodSignature) joinPoint.getSignature();
//        Method method = signature.getMethod();
//        Hh annotation = method.getAnnotation(Hh.class);
//        System.out.println("注解 before");
//    }




    //before可以是某个切点之前，也可以在注解之前，如果是注解的话，可以直接注解

}
